package main
import(
	"fmt"
)
//排序
func main(){
	slice := []int{11,34,54,21,45,1,98}
	slice = bubbleSort(slice)
	fmt.Println(slice)
}

func bubbleSort(slice []int) []int{
	for i:=0;i<len(slice)-1;i++{
		for j:=0;j<len(slice)-i-1;j++{
			if(slice[j] > slice[j+1]){
				exchange(&slice[j],&slice[j+1])
			}
		}
	}
	return slice
}

func exchange(a *int,b *int){
	*a = *a + *b
	*b = *a - *b
	*a = *a - *b
}